#pragma once

namespace ywx {
	template<class Iterator, class Ref, class Ptr>
	struct ReverseIterator {
		typedef ReverseIterator<Iterator, Ref, Ptr> reverse_iterator;
		Iterator _it;
		ReverseIterator(Iterator it)
			:_it(it)
		{}

		Ref operator*()
		{
			Iterator tmp = _it;
			return *(--tmp);
		}

		Ptr operator->()
		{
			return &(operator*())
		}

		reverse_iterator& operator--()
		{
			++_it;
			return *this; 
		}

		reverse_iterator& operator++()
		{
			--_it;
			return *this;
		}

		bool operator!=(reverse_iterator it)
		{
			return _it != it._it;
		}

		bool operator==(reverse_iterator it)
		{
			return _it == it._it;
		}

	};
}